package com.sense.kukoo.common.repo.kv

import android.content.Context
import com.sense.kukoo.common.repo.kv.data_version.DataVersionImpl
import com.tencent.mmkv.MMKV

class KukooKeyValueManager {

    private val TAG: String = javaClass.simpleName

    companion object{
        val KEY_DATA_VERSION_CODE = "data_version_code"
        val KEY_DATA_VERSION_ISRELEASE = "data_version_isRelease"
        val KEY_LOGIN = "login"
        val KEY_LOGIN_TYPE = "last_login_type"
        val KEY_HISTORY = "search_history"
        val KEY_USER = "user"
        val KEY_SPEED = "speed"
        val KEY_BOOK_SEQUENCE = "book_sequence"
        val KEY_PLAYLIST = "playlist"
        val KEY_PLAYLIST_POSITION = "playlist_position"
        val KEY_DAY_NIGHT = "day_night"

        private lateinit var kukooMmkv :MMKV
        private lateinit var mDataVersionImpl :DataVersionImpl

        fun init(context: Context){
            MMKV.initialize(context)
            kukooMmkv = MMKV.mmkvWithID("kukoo")
            mDataVersionImpl = DataVersionImpl(kukooMmkv)
        }

        fun setDataVersionAndType(versionCode:Int, isRelease:Boolean){
            mDataVersionImpl.updataVersionAndType(versionCode, isRelease)
        }

        fun kukooMmkv() :MMKV{
            return kukooMmkv
        }

    }
}